<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%>

 <%
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
 %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
 		<link rel="stylesheet" type="text/css" href="<%=basePath %>/css/updateVideo.css" />
        <link rel="stylesheet" href="<%=basePath %>/css/list.css">
		<link href="<%=basePath %>/css/H-ui.min.css" rel="stylesheet" type="text/css" />
		<link href="<%=basePath %>/css/formsCSS.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" type="text/css" href="<%=basePath %>/css/simditor.css" />
		<script src="<%=basePath%>/lib/My97DatePicker/WdatePicker.js"></script>
		<script src="<%=basePath %>/js/jquery.min.js"></script>
		<script src="<%=basePath %>/js/formsJS.js"></script>
		
		<script type="text/javascript" src="<%=basePath %>/js/module.js"></script>
		<script type="text/javascript" src="<%=basePath %>/js/hotkeys.js"></script>
		<script type="text/javascript" src="<%=basePath %>/js/uploader.js"></script>
		<script type="text/javascript" src="<%=basePath %>/js/simditor.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/H-ui.js"></script>

<script type="text/javascript">

function checkForm(f){

	if(f.title.value.replace(/\s/g,'') == ''){
		alert("活动名称不能为空");
		return false;
	}
	if(f.cost.value.replace(/\s/g,'') == ''){
		alert("优惠价钱不能为空");
		return false;
	}
	if(f.condition_cost.value.replace(/\s/g,'') == ''){
		alert("满足优惠条件价钱不能为空");
		return false;
	}
	if(f.status.value.replace(/\s/g,'') == ''){
		alert("活动状态不能为空");
		return false;
	}
 
	return true;
}
$(function(){
	var ids=$("#ids").val();
	if(ids!=0 ||ids!=null ||ids!=""){
		
		var is=$("#isd").val();;
		$("#id").val(is);
	}
	
	
})
</script>
</head>
<body>
<div class="connect_wrap">
  		<h3 style= "text-align: center;">优惠活动维护</h3>
	<div class="row cl" style="max-width:88%;margin-left:8%;">
	<div class="labelText"></div>
 <form action="<%=basePath%>/activity/activityEdit" method="post" onsubmit="return checkForm(this)"
	enctype="multipart/form-data">
	<div class="col-sm-4"></div>
		<div class="col-sm-4">
				<div class="boxs">
				<input type="hidden" name="ids" id="ids" value=""><br />
				<input type="hidden" name="id" id="id" value=""><br />
				<input type="hidden" name="isd" id="isd" value="${page.id}"/>
			 	<input type="text" class="inputBox" placeholder="活动名称" name="title" value="${page.title}" >
				<input type="number" class="inputBox" placeholder="优惠价钱" name="cost" value="${page.cost}" >
				<input type="number" class="inputBox" placeholder="满足优惠条件价钱" name="condition_cost" value="${page.condition_cost}" >
				<input type="text" placeholder="开始时间" class="name Wdate inputBox" name="begin_time" value="${page.begin_time}" 
											    		onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"><br />
			    <input type="text" placeholder="结束时间" class="name Wdate inputBox" name="end_time" value="${page.end_time}" 
			    		onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"><br />
			   <div class="labelText" style="position: relative; top: 20px; left: 0px; color: rgb(154, 144, 144);">活动状态</div>
				<select id="status" name="status" class="selectBox"  >
				  	<option value="">活动状态</option>
		  			<option value="1" ${page.status == 1 ? 'selected="selected"' : '' }>进行中</option>
		  			<option value="2" ${page.status == 2 ? 'selected="selected"' : '' }>已停止</option>
				</select>
			 
			<br /><br />
			<input type="submit" value="确定" class="true" />
			<input type="button"  class="false" value="取消" onclick="window.history.go(-1)">
		</div>
			</div>
		</form> 
		</div>
</div>

</body>
</html>